﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 更新采购申请明细 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_SysPurchaseRequestBillEntry_FrameworkGroups_GroupId",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropForeignKey(
                name: "FK_SysPurchaseRequestBillEntry_SysOrg_OrgId",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropIndex(
                name: "IX_SysPurchaseRequestBillEntry_GroupId",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropIndex(
                name: "IX_SysPurchaseRequestBillEntry_OrgId",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "ApprovalTime",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "Approver",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "BillCode",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "BillStatus",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "GroupId",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "OrgId",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "Remark",
                table: "SysPurchaseRequestBillEntry");

            migrationBuilder.DropColumn(
                name: "WorkflowStatus",
                table: "SysPurchaseRequestBillEntry");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<DateTime>(
                name: "ApprovalTime",
                table: "SysPurchaseRequestBillEntry",
                type: "datetime2",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Approver",
                table: "SysPurchaseRequestBillEntry",
                type: "nvarchar(64)",
                maxLength: 64,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "BillCode",
                table: "SysPurchaseRequestBillEntry",
                type: "nvarchar(128)",
                maxLength: 128,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<int>(
                name: "BillStatus",
                table: "SysPurchaseRequestBillEntry",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "GroupId",
                table: "SysPurchaseRequestBillEntry",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "OrgId",
                table: "SysPurchaseRequestBillEntry",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Remark",
                table: "SysPurchaseRequestBillEntry",
                type: "nvarchar(512)",
                maxLength: 512,
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "WorkflowStatus",
                table: "SysPurchaseRequestBillEntry",
                type: "int",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_SysPurchaseRequestBillEntry_GroupId",
                table: "SysPurchaseRequestBillEntry",
                column: "GroupId");

            migrationBuilder.CreateIndex(
                name: "IX_SysPurchaseRequestBillEntry_OrgId",
                table: "SysPurchaseRequestBillEntry",
                column: "OrgId");

            migrationBuilder.AddForeignKey(
                name: "FK_SysPurchaseRequestBillEntry_FrameworkGroups_GroupId",
                table: "SysPurchaseRequestBillEntry",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");

            migrationBuilder.AddForeignKey(
                name: "FK_SysPurchaseRequestBillEntry_SysOrg_OrgId",
                table: "SysPurchaseRequestBillEntry",
                column: "OrgId",
                principalTable: "SysOrg",
                principalColumn: "ID");
        }
    }
}
